*-------------------------------------------------------------------------------
*
*                   Analyses for "Identity, Information, and Voting:
*                Lessons on African Elections from a Survey Experiment"
*
*                                   2025-06-18
*
*-------------------------------------------------------------------------------

* Setting working directory
cd "Replication Materials\Data"
use "EVMB_CTRL.dta"

*-------------------------------------------------------------------------------
* STEP 1: Main Effects in Natural Mediator Arm (AMCEs)
*-------------------------------------------------------------------------------

encode region, gen(Region)

*Vote
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1, robust

est store amce1 

*Regression Table - Table 6 
esttab amce1 using amces1.tex, se label replace booktabs ///
alignment (D{.}{.}{-1}) ///
title(Average Marginal Component Effects\label{tab1})

*------------------------------------------Robustness Check: By Country

encode country, gen(Country)

*---Malawi
*Vote
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1 & Country==2, robust
est store amce1M 

*---Kenya
*Vote
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1 & Country==1, robust
est store amce1K 

*---Zambia
*Vote
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1 & Country==3, robust
est store amce1Z 

*Regression Table - Table B1 
*Table of All and Country Specific AMCE - Vote Outcome
esttab amce1 amce1K amce1M amce1Z using amces_full_all.tex, se label replace booktabs ///
alignment (D{.}{.}{-1}) ///
title(Average Marginal Component Effects ALL\label{tab1})

*------------------------------------------Robustness Check: Ordinal Regression
* See first column of Table B13 created in the Step 3 code below.



*-------------------------------------------------------------------------------
* STEP 2: Mediation Analysis
*-------------------------------------------------------------------------------

*Create indicator for natural mediator arm
gen z= 0 if Mediator!=.
replace z= 1 if Mediator==1


*---COMPETENCY
*Vote 
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (z==1 |Mediator==2), robust
est store mediation1C

*---ETHNIC FAVORITISM
*Vote 
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (z==1 |Mediator==3), robust
est store mediation1E

*---GEOGRAPHIC FAVORITISM
*Vote 
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (z==1 |Mediator==4), robust
est store mediation1V

*---ACCESSIBILITY
*Vote 
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (z==1 |Mediator==5), robust
est store mediation1A

*Regression Table - Table B2
esttab mediation1E mediation1V mediation1C mediation1A using mediations_all.tex, se label replace booktabs ///
alignment (D{.}{.}{-1}) ///
title(Mediation All Countries\label{tab1})



*------------------------------------------Robustness Check: BY COUNTRY

*KENYA
*---ETHNIC FAVORITISM
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (Country==1 & (z==1 |Mediator==3)), robust
est store mediation1M

*---GEOGRAPHIC FAVORITISM
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (Country==1 & (z==1 |Mediator==4)), robust
est store mediation2K

*---COMPETENCY
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (Country==1 & (z==1 |Mediator==2)), robust
est store mediation3K

*---ACCESSIBILITY
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (Country==1 & (z==1 |Mediator==5)), robust
est store mediation4K

*Regression Table - Table B4
esttab mediation1K mediation2K mediation3K mediation4K using Kmediations_obs.tex, se label replace booktabs ///
alignment (D{.}{.}{-1}) ///
title(Mediation Kenya\label{tab1})


*-MALAWI
*---ETHNIC FAVORITISM
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (Country==2 & (z==1 |Mediator==3)), robust
est store mediation1M

*---GEOGRAPHIC FAVORITISM
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (Country==2 & (z==1 |Mediator==4)), robust
est store mediation2M

*---COMPETENCY
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (Country==2 & (z==1 |Mediator==2)), robust
est store mediation3M

*---ACCESSIBILITY
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (Country==2 & (z==1 |Mediator==5)), robust
est store mediation4M

*Regression Table - Table B5
esttab mediation1M mediation2M mediation3M mediation4M using Mmediations_obs.tex, se label replace booktabs ///
alignment (D{.}{.}{-1}) ///
title(Mediation Malawi\label{tab1})


*ZAMBIA
*---ETHNIC FAVORITISM
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (Country==3 & (z==1 |Mediator==3)), robust
est store mediation1Z

*---GEOGRAPHIC FAVORITISM
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (Country==3 & (z==1 |Mediator==4)), robust
est store mediation2Z

*---COMPETENCY
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (Country==3 & (z==1 |Mediator==2)), robust
est store mediation3Z

*---ACCESSIBILITY
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (Country==3 & (z==1 |Mediator==5)), robust
est store mediation4Z

*Regression Table - Table B6
esttab mediation1Z mediation2Z mediation3Z mediation4Z using Zmediations_obs.tex, se label replace booktabs ///
alignment (D{.}{.}{-1}) ///
title(Mediation Zambia\label{tab1})



*------------------------------------------Robustness Check: By Capital vs Border Areas

gen CapBorder = Region
recode CapBorder 1=1 2=1 3=2 4=1 5=2

*CAPITAL

*---ETHNIC FAVORITISM
reg vote ib2.ethnicity_at ib1.gender_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (CapBorder == 1 & (z==1 |Mediator==3)), robust
est store mediation1C

*---GEOGRAPHIC FAVORITISM
reg vote ib2.ethnicity_at ib1.gender_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(gender_at == 1) i.Region if (CapBorder == 1 & (z==1 |Mediator==4)), robust
est store mediation2C

*---COMPETENCY
reg vote ib2.ethnicity_at ib1.gender_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (CapBorder == 1 & (z==1 |Mediator==2)), robust
est store mediation3C

*---ACCESSIBILITY
reg vote ib2.ethnicity_at ib1.gender_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (CapBorder == 1 & (z==1 |Mediator==5)), robust
est store mediation4C

*Regression Table - Table B7
esttab mediation1C mediation2C mediation3C mediation4C using Cmediations_obs.tex, se label replace booktabs ///
alignment (D{.}{.}{-1}) ///
title(Mediation Border Regions\label{tab1})

*BORDER

*---ETHNIC FAVORITISM
reg vote ib2.ethnicity_at ib1.gender_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (CapBorder == 2 & (z==1 |Mediator==3)), robust
est store mediation1B

*---GEOGRAPHIC FAVORITISM
reg vote ib2.ethnicity_at ib1.gender_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(gender_at == 1) i.Region if (CapBorder == 2 & (z==1 |Mediator==4)), robust
est store mediation2B

*---COMPETENCY
reg vote ib2.ethnicity_at ib1.gender_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (CapBorder == 2 & (z==1 |Mediator==2)), robust
est store mediation3B

*---ACCESSIBILITY
reg vote ib2.ethnicity_at ib1.gender_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (CapBorder == 2 & (z==1 |Mediator==5)), robust
est store mediation4B

*Regression Table - Table B8
esttab mediation1B mediation2B mediation3B mediation4B using Bmediations_obs.tex, se label replace booktabs ///
alignment (D{.}{.}{-1}) ///
title(Mediation Border Regions\label{tab1})


*------------------------------------------Robustness Check: By Local Ethnicy Minority/Majority

encode RespInLargestGroup, gen(majority_at)

*Ethnic Majority
*---ETHNIC FAVORITISM
reg vote ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (majority_at == 2 & (z==1 |Mediator==3)), robust
est store mediation1Maj2

*---GEOGRAPHIC FAVORITISM
reg vote ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(gender_at == 1) i.Region if (majority_at == 2 (z==1 |Mediator==4)), robust
est store mediation2Maj2

*---COMPETENCY
reg vote ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (majority_at == 2 & (z==1 |Mediator==2)), robust
est store mediation3Maj2

*---ACCESSIBILITY
reg vote ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (majority_at == 2 & (z==1 |Mediator==5)), robust
est store mediation4Maj2

*Regression Table B9
esttab mediation1Maj2 mediation2Maj2 mediation3Maj2 mediation4Maj2 using Majmediations_obs.tex, se label replace booktabs ///
alignment (D{.}{.}{-1}) ///
title(Mediation Ethnic Majority\label{tab1})

*Ethnic Minority
*---ETHNIC FAVORITISM
reg vote ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (majority_at == 1 & (z==1 |Mediator==3)), robust
est store mediation1Minl

*---GEOGRAPHIC FAVORITISM
reg vote ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(gender_at == 1) i.Region if (majority_at == 1 (z==1 |Mediator==4)), robust
est store mediation2Minl

*---COMPETENCY
reg vote ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (majority_at == 1 & (z==1 |Mediator==2)), robust
est store mediation3Minl

*---ACCESSIBILITY
reg vote ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (majority_at == 1 & (z==1 |Mediator==5)), robust
est store mediation4Minl

*Regression Table B10
esttab mediation1Minl mediation2Minl mediation3Minl mediation4Minl using Minmediations_obs.tex, se label replace booktabs ///
alignment (D{.}{.}{-1}) ///
title(Mediation Ethnic Majority\label{tab1})




*------------------------------------------Robustness Check: By Candidate Gender

*MALE

*---ETHNIC FAVORITISM
reg vote ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (gender_at == 1 & (z==1 |Mediator==3)), robust
est store mediation1Ml

*---GEOGRAPHIC FAVORITISM
reg vote ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(gender_at == 1) i.Region if (gender_at == 1 (z==1 |Mediator==4)), robust
est store mediation2Ml

*---COMPETENCY
reg vote ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (gender_at == 1 & (z==1 |Mediator==2)), robust
est store mediation3Ml

*---ACCESSIBILITY
reg vote ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (gender_at == 1 & (z==1 |Mediator==5)), robust
est store mediation4Ml

*Regression Table B15
esttab mediation1Ml mediation2Ml mediation3Ml mediation4Ml using MLmediations_obs.tex, se label replace booktabs ///
alignment (D{.}{.}{-1}) ///
title(Mediation Male Candidate\label{tab1})

*FEMALE

*---ETHNIC FAVORITISM
reg vote ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (gender_at == 2 & (z==1 |Mediator==3)), robust
est store mediation1F

*---GEOGRAPHIC FAVORITISM
reg vote ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(gender_at == 1) i.Region if (gender_at == 2 & (z==1 |Mediator==4)), robust
est store mediation2F

*---COMPETENCY
reg vote ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (gender_at == 2 & (z==1 |Mediator==2)), robust
est store mediation3F

*---ACCESSIBILITY
reg vote ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(ethnicity_at) i.Region if (gender_at == 2 & (z==1 |Mediator==5)), robust
est store mediation4F

*Regression Table - B16
esttab mediation1F mediation2F mediation3F mediation4F using Fmediations_obs.tex, se label replace booktabs ///
alignment (D{.}{.}{-1}) ///
title(Mediation Female Candidate\label{tab1})




*-------------------------------------------------------------------------------
* STEP 3: Main Effects in Natural Mediator Arm, Mechanism Outcomes
*-------------------------------------------------------------------------------

*Help Ethnic Group
reg helpethnic ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1, robust
est store amce1

*Help Village
reg helpvillage ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1, robust
est store amce2

*Mobilize
reg mobilize ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1, robust
est store amce3

*Own Gain
reg owngain ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1, robust
est store amce4

*Transparency
reg transparent ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1, robust
est store amce5

*Find Corrupt
reg findcorrupt ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1, robust
est store amce6

*Sanction
reg sanction ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1, robust
est store amce7

*Spending priorities
reg spendprior ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1, robust
est store amce8

*Regression Table - Table B3 & Table 8 (subset of Table B3)
esttab amce1 amce2 amce3 amce4 amce5 amce6 amce7 amce8 using amces1_mech.tex, se label replace booktabs ///
alignment (D{.}{.}{-1}) ///
title(Average Marginal Component Effects - Mechanisms\label{tab1})


*----------------------------------------Robustness Check - Ordinal Regression

*Vote
ologit voteordinal ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1, robust
est store amce1

*Help Ethnic Group
ologit helpethnic ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1, robust
est store amce2

*Help Village
ologit helpvillage ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1, robust
est store amce3

*Mobilize
ologit mobilize ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1, robust
est store amce4

*Own Gain
ologit owngain ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1, robust
est store amce5

*Transparency
ologit transparent ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1, robust
est store amce6

*Find Corruption
ologit findcorrupt ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1, robust
est store amce7

*Sanction
ologit sanction ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1, robust
est store amce8

*Spending Priorities
ologit spendprior ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at i.Region if Mediator==1, robust
est store amce9


*Regrssion Table - Table B13
esttab amce1 amce2 amce3 amce4 amce5 amce6 amce7 amce8 amce9 using OrdRegCombined2.tex, nobaselevels se label 



*-------------------------------------------------------------------------------
* Exploring Potential Limintations
*-------------------------------------------------------------------------------


*---------------------------------Effect of Mediations on Mechanisms

*---helpethnic
reg helpethnic ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at ib1.Mediator i.Region, robust
est store helpEthnicMech

*---helpvillage
reg helpvillage ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at ib1.Mediator i.Region, robust
est store helpVillageMech

*---mobilize
reg mobilize ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at ib1.Mediator i.Region, robust
est store mobilizeMech

*---owngain
reg owngain ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at ib1.Mediator i.Region, robust
est store ownGainMech

*---transparent
reg transparent ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at ib1.Mediator i.Region, robust
est store transparentMech

*---findcorrupt
reg findcorrupt ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at ib1.Mediator i.Region, robust
est store findCorruptionMech

*---sanction
reg sanction ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at ib1.Mediator i.Region, robust
est store sanctionMech

*---spendprior
reg spendprior ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at ib1.Mediator i.Region, robust
est store spendPriorMech

*Regression Table - Table B14
esttab helpEthnicMech helpVillageMech mobilizeMech ownGainMech transparentMech findCorruptionMech sanctionMech spendPriorMech using EffectMechanisms_obs.tex, se label replace booktabs ///
alignment (D{.}{.}{-1}) ///
title(Mediatior Effect on Mechanisms\label{tab1})


*---------------------------------Mediation of Candidate Origin on Vote Choice

*---ETHNIC FAVORITISM
*Vote 
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(origin_at) i.Region if (z==1 |Mediator==3), robust
est store mediation1

*---GEOGRAPHIC FAVORITISM
*Vote 
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(origin_at) i.Region if (z==1 |Mediator==4), robust
est store mediation2

*---COMPETENCY
*Vote 
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(origin_at) i.Region if (z==1 |Mediator==2), robust
est store mediation3

*---ACCESSIBILITY
*Vote 
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(origin_at) i.Region if (z==1 |Mediator==5), robust
est store mediation4

*Regression Table - Table B11
esttab mediation1 mediation2 mediation3 mediation4 using mediations_origin_obs.tex, se label replace booktabs nobaselevels ///
alignment (D{.}{.}{-1}) ///
title(Mediation of Candidate Origin\label{MediationOrigin})


*---------------------------------Mediation of Candidate Residence on Vote Choice


*---ETHNIC FAVORITISM
*Vote 
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(livingstatus_at) i.Region if (z==1 |Mediator==3), robust
est store mediation1

*---GEOGRAPHIC FAVORITISM
*Vote 
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(livingstatus_at) i.Region if (z==1 |Mediator==4), robust
est store mediation2

*---COMPETENCY
*Vote 
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(livingstatus_at) i.Region if (z==1 |Mediator==2), robust
est store mediation3

*---ACCESSIBILITY
*Vote 
reg vote ib1.gender_at ib2.ethnicity_at ib2.origin_at ib2.livingstatus_at ib1.religion_at ib1.age_at ib2.class_at z z##(livingstatus_at) i.Region if (z==1 |Mediator==5), robust
est store mediation4

*Regression Table - Table B12
esttab mediation1 mediation2 mediation3 mediation4 using mediations_residence_obs.tex, se label replace booktabs nobaselevels ///
alignment (D{.}{.}{-1}) ///
title(Mediation of Candidate Residence\label{MediationResidence})


*-----------------------------------------------------------END